<html xmlns:th="http://www.thymeleaf.org">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <title>后台管理</title>
  <!-- 所有script封装到一起 -->
  <div th:replace="admin/common/scriptBar :: script"  ></div>
</head>
<body id="page-top">
<div id="wrapper" class="set-min-height">
  <div th:replace="admin/common/leftPageBar :: leftPage"  ></div>
  <div id="content-wrapper" class="d-flex flex-column">
    <!-- 页面开始 -->
    <div id="content">
      <div th:replace="admin/common/headPageBar :: headPage"  ></div>
      <!-- 页面内容开始 -->
      <div class="container-fluid">
        <div class="row">
        <div class="container-fluid" style="width:60% ">
            <input type="hidden" id="adminId" th:value="${session.adminId}" >
            <div class="form-group">
                <span> 原密码： </span>
                <input type="password" id="preAdminPassword" placeholder="请输入原密码" class="form-control form-control-user" aria-describedby="emailHelp">
            </div>
            <div class="form-group">
                <span> 新密码： </span>
                <input type="password" id="newAdminPassword1" placeholder="请输入新密码" class="form-control form-control-user" aria-describedby="emailHelp">
            </div>
            <div class="form-group">
                <span> 重复输入新密码： </span>
                <input type="password" id="newAdminPassword2" placeholder="请再次输入新密码" class="form-control form-control-user" aria-describedby="emailHelp">
            </div>
            <p><input class="btn btn-primary btn-user btn-block" id="updateAdminPassword" type="submit" value="重置密码"/></p>
        </div>
        </div>
      </div>
      <!-- 页面内容结束 -->

    </div>
    <!-- 页面结束 -->
    <div th:replace="admin/common/footerBar :: footer"  ></div>
  </div>
</div>

<script type="text/javascript">
    $("input[id='updateAdminPassword']").click(function(){
        if($("input[id='newAdminPassword1']").val()==$("input[id='newAdminPassword2']").val()){
            $.post("./updateAdminPassword",
                {"adminId":$("input[id='adminId']").val(),
                    "preAdminPassword":$("input[id='preAdminPassword']").val(),
                    "newAdminPassword":$("input[id='newAdminPassword1']").val()},
                function(data){
                    alert(data['msg']);
                })
        }else{
            alert("两次输入的密码不一致");
        }
    });
</script>
</body>
</html>
